/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entidades;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Damian
 */
@Entity
@Table(name = "local_econ_type")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "LocalEconType.findAll", query = "SELECT l FROM LocalEconType l"),
    @NamedQuery(name = "LocalEconType.findByIdLocalEconType", query = "SELECT l FROM LocalEconType l WHERE l.idLocalEconType = :idLocalEconType"),
    @NamedQuery(name = "LocalEconType.findByName", query = "SELECT l FROM LocalEconType l WHERE l.name = :name"),
    @NamedQuery(name = "LocalEconType.findByPrice", query = "SELECT l FROM LocalEconType l WHERE l.price = :price")})
public class LocalEconType implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "ID_LOCAL_ECON_TYPE")
    private Integer idLocalEconType;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(name = "NAME")
    private String name;
    @Basic(optional = false)
    @NotNull
    @Column(name = "PRICE")
    private double price;
    @OneToMany(mappedBy = "economicType")
    private Collection<Local> localCollection;

    public LocalEconType() {
    }

    public LocalEconType(Integer idLocalEconType) {
        this.idLocalEconType = idLocalEconType;
    }

    public LocalEconType(Integer idLocalEconType, String name, double price) {
        this.idLocalEconType = idLocalEconType;
        this.name = name;
        this.price = price;
    }

    public Integer getIdLocalEconType() {
        return idLocalEconType;
    }

    public void setIdLocalEconType(Integer idLocalEconType) {
        this.idLocalEconType = idLocalEconType;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    @XmlTransient
    public Collection<Local> getLocalCollection() {
        return localCollection;
    }

    public void setLocalCollection(Collection<Local> localCollection) {
        this.localCollection = localCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idLocalEconType != null ? idLocalEconType.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof LocalEconType)) {
            return false;
        }
        LocalEconType other = (LocalEconType) object;
        if ((this.idLocalEconType == null && other.idLocalEconType != null) || (this.idLocalEconType != null && !this.idLocalEconType.equals(other.idLocalEconType))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entidades.LocalEconType[ idLocalEconType=" + idLocalEconType + " ]";
    }
    
}
